<?php
// *** Tangra (Application Framework and Tools for PHP)
// $Id$
//

require_once(TANGRA_MAIN_DIR.'web_site/session_vars_manager.class.php');
require_once(TANGRA_MAIN_DIR.'web_site/threads_manager.class.php');

require_once($WSC->get_site_inc_dir().'modules/web_site_chocolate/chocolate_web_page.class.php');
require_once($WSC->get_site_inc_dir().'modules/web_site_caramel/caramel_web_page_view.class.php');


class Caramel_Web_Page extends Chocolate_Web_Page {
	public function create_view($name = 'default') {
		$ret = new Caramel_Web_Page_View($this, $name);

		return $ret;
	}


	public function get_tvm() {
		$svm = $this->get_svm();

		$tm = $svm->get_global_var(THREADS_MANAGER_NAME);
		$tvm = $tm->get_current_thread_vm();

		return $tvm;
	}


	public function query_tvm() {
		$svm = $this->get_svm();

		$tm = $svm->get_global_var(THREADS_MANAGER_NAME);
		$tvm = $tm->get_current_thread_vm();

		return $tvm;
	}



	public function init() {
		parent::init();

		$svm = $this->get_svm();
		$tm = $svm->get_global_var(THREADS_MANAGER_NAME);

		$this->export($tm->get_url_rewrite_var_name(), $tm->get_current_url_var());
		$this->export('_tm_snaphots_lifetime', $tm->get_snapshots_lifetime());
	}
}

